<html>
<head>
    <script src="options_utility.js"></script>
    <script>

        chrome.extension.onConnect.addListener(
            function(port)
            {
                if (port.name == 'contextsearch')
                {
                    port.onMessage.addListener(
                        function(message)
                        {
                            if (message.name == 'getOptions')
                            {
                                port.postMessage(new Options().array);
                            }
                            else if (message.name == 'newTab')
                            {
                                chrome.tabs.getSelected(
                                    null,
                                    function(tab)
                                    {
                                        var createTabParams = { url: message.param };
                                        if (tab)
                                        {
                                            createTabParams.index = tab.index + 1;
                                        }
                                        chrome.tabs.create(createTabParams);
                                    });
                            }
                        });
                }
            });

            function initialize()
            {
            }

    </script>
</head>
<body onload="initialize()"></body>
</html>
